﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmartBoard.Core.UI;

namespace SmartBoard.Core.Login
{
    public interface ILoginUIPresenter:IUIPresenter
    {
        string UserName { get; set;}
        string AuthenticationToken { get; set;}
        event EventHandler LoginRequested;
        event EventHandler CancelRequested;
    }

    public class LoginController
    {
        public static UserInfo DoLogin(ILoginUIPresenter loginUIPresenter)
        {
            //if (loginUIPresenter == null)
            //    return null;

            //loginUIPresenter.LoginRequested += HandleLoginRequested;
            //loginUIPresenter.CancelRequested += HandleCancelRequested;
            //if(loginUIPresenter.PresentUI()==true)
            //{
                
            //}
            //return null;
            return new UserInfo();
        }

        private static void HandleLoginRequested(object sender, EventArgs e)
        {
            var loginUIPresenter = (ILoginUIPresenter)sender;
            
        }

        private static void HandleCancelRequested(object sender, EventArgs e)
        {
            var loginUIPresenter = (ILoginUIPresenter)sender;
            
        }

        private static void RemoveEvents(ILoginUIPresenter loginUIPresenter)
        {
            loginUIPresenter.LoginRequested -= HandleLoginRequested;
            loginUIPresenter.CancelRequested -= HandleCancelRequested;
        }
    }
}
